<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var str = "_f.'-=sdhhfhlsjdjk72894k432843j3882";

        // \d表示数字相当于[0-9]
        var reg = /\d/g;
        console.log(str.replace(reg,"^"));
        // \w表示数字字母下划线
        console.log(str.replace(/\w/g,"^"));
        // .代表所有字符和符号
        console.log(str.replace(/./g,"^"));
    </script>
</body>
</html>